<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>{:t('会员')}审核</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
  {include file="public/css"/}
	<script src="__STATIC__/admin/js/address3.js"></script>
	<style>
		.alert{
			position: fixed;
			height: 100%;
			width: 100%;
			top: 0;
			left: 0;
			z-index: 5;
			display: none;
			background: rgba(0, 0, 0, 0.7);
		}
		.alert_container{
			position: absolute;
			height: 100%;
			width: 100%;
			display: flex;
			align-items: center;
			justify-content: center;
		}
		.alert_module{
			padding: 15px;
			border-radius: 5px;
			background: #fff;
		}
		.alert_title{
			font-size: 18px;
			color: #303133;
			display: flex;
			align-items: center;
			justify-content: space-between;
		}
		.alert_content{
			width: 650px;
			padding: 15px 0;
			display: flex;
		}
		.alert_area{
			flex: 1;
			height: 400px;
			overflow-y: scroll;
		}
		.alert_item{
			font-size: 14px;
			color: #333;
			padding: 0 15px;
			display: flex;
			cursor: pointer;
			min-width: 0;
			align-items: center;
		}
		.alert_icon{
			height: 18px;
			width: 18px;
			box-sizing: border-box;
			border-radius: 4px;
			border: 1px solid;
			background: #fff;
			border-color: #c9c9c9;
		}
		.alert_active{
			display: flex;
			align-items: center;
			justify-content: center;
			background: #1e9fff;
			border-color: #1e9fff;
		}
		.alert_text{
			flex: 1;
			padding: 10px;
			overflow: hidden;
			text-overflow: ellipsis;
			white-space: nowrap;
			min-width: 0;
		}
		.alert_item:hover{
			background: #ebf5ff;
		}
		.alert_close{
			cursor: pointer;
		}
		.alert_close:hover{
			color: #1e9fff;
		}
		.alert_opt{
			position: relative;
			display: flex;
			justify-content: flex-end;
		}
		.alert_opt button{
			margin-left: 10px;
		}
		::-webkit-scrollbar {
			width: 10px;
			height: 10px;
			background-color: #fff;
			border-radius: 5px;
		}
		::-webkit-scrollbar-thumb {
			background-color: silver;
			border-radius: 5px;
		}
		::-webkit-scrollbar-track {
			background-color: #fff;
		}

		.area{
			position: relative;
			display: flex;
		}
		.area_module{
			padding: 5px 10px;
			border-width: 1px;
			border-style: solid;
			border-color: #e6e6e6;
			background-color: #fff;
			border-radius: 2px;
			display: flex;
			align-items: center;
			font-size: 14px;
			cursor: pointer;
		}
		.area_content{
			min-width: 150px;
			display: flex;
			color: #c9c9c9;
			flex-wrap: wrap;
		}
		.area_item{
			padding: 2px 10px;
			background: #009688;
			color: #fff;
			display: flex;
			align-items: center;
			border-radius: 2px;
			font-size: 14px;
			margin: 2.5px;
		}
	</style>
</head>
<body>
  <div class="layui-fluid">
    <div class="layui-row layui-col-space15">
			<div class="layui-card layui-col-md12">
				<div class="layui-card-header"><i class="fa fa-edit"></i> {:t('会员')}审核<i class="layui-icon layui-icon-close" style="font-size:18px;font-weight:bold;cursor:pointer" onclick="closeself()"></i></div>
        <div class="layui-card-body" pad15>
					<div class="layui-form form-label-w6" lay-filter="form">
						<input type="hidden" name="info[id]" value="{$info.id}"/>
						<input type="hidden" name="infoid"  id="infoid" value="{$info.id}"/>
					<!--自定义信息start-->
 					 {if getcustom('register_fields')}
  					<input type="hidden" name="formdata[id]" value="{$register_record.id}">
  					
						{volist name="register_record.content" id="item" key="key"}
						{php}
							$formkey = 'form'.($key-1);
							$val = $register_record['form'.($key-1)]??'';
						{/php}
						{if $item.key=='input'}
						<div class="layui-form-item">
							<label class="layui-form-label">{$item.val1}</label>
							<div class="layui-input-inline">
								<input type="text" name="formdata[{$formkey}]" class="layui-input" value="{$val}">
							</div>
						</div>
						{/if}
						{if $item.key=='textarea'}
						<div class="layui-form-item">
							<label class="layui-form-label">{$item.val1}</label>
							<div class="layui-input-inline" style="min-width: 300px">
								<textarea class="layui-textarea" name="formdata[{$formkey}]">{$val}</textarea>
							</div>
						</div>
						{/if}
						{if $item.key=='seletor'}
						<div class="layui-form-item">
							<label class="layui-form-label">{$item.val1}</label>
							<div class="layui-input-inline">
								<select name="formdata[{$formkey}]" class="layui-select">
									<option name="">请选择</option>
									{volist name="item.val2" id="item2"}
									<option name="">{$item2}</option>
									{/volist}
								</select>
							</div>
						</div>
						{/if}
						{if $item.key=='radio'}
						<div class="layui-form-item">
							<label class="layui-form-label">{$item.val1}</label>
							<div class="layui-input-inline">
								{volist name="item.val2" id="item2"}
									<label><input type="radio" name="formdata[{$formkey}]" title="{$item2}" value="{$item2}" {if $item2==$val}checked{/if}></label>
								{/volist}
							</div>
						</div>
						{/if}
						{if $item.key=='checkbox'}
						{php}
						$val = explode(',',$val);
						{/php}
						<div class="layui-form-item">
							<label class="layui-form-label">{$item.val1}</label>
							<div class="layui-input-inline" style="min-width: 40%">
								{volist name="item.val2" id="item2"}
								<input type="checkbox" name="formdata[{$formkey}][]" value="{$item2}" title="{$item2}" {if in_array($item2,$val)}checked{/if}>
								{/volist}
							</div>
						</div>
						{/if}
						{if $item.key=='seletor'}
						<div class="layui-form-item">
							<label class="layui-form-label">{$item.val1}</label>
							<div class="layui-input-inline">
								<select name="formdata[{$formkey}]" class="layui-select">
									<option name="">请选择</option>
									{volist name="item.val2" id="item2"}
									<option name="formdata[{$formkey}]" {if $item2==$val}selected{/if}>{$item2}</option>
									{/volist}
								</select>
							</div>
						</div>
						{/if}
						{if $item.key=='time'}
						<div class="layui-form-item">
							<label class="layui-form-label">{$item.val1}</label>
							<div class="layui-input-inline">
								<input type="text" name="formdata[{$formkey}]" id="{$formkey}" class="layui-input timeinput" value="{$val}">
							</div>
						</div>
						{/if}
						{if $item.key=='date'}
						<div class="layui-form-item">
							<label class="layui-form-label">{$item.val1}</label>
							<div class="layui-input-inline">
								<input type="text" name="formdata[{$formkey}]" id="{$formkey}" class="layui-input dateinput" value="{$val}">
							</div>
						</div>
						{/if}
						{if $item.key=='upload'}
						<div class="layui-form-item">
							<label class="layui-form-label">{$item.val1}</label>
							<div class="layui-input-inline" style="min-width: 40%">
								<input type="hidden" name="formdata[{$formkey}]" id="formpic{$formkey}" class="layui-input" value="{$val}">
								<button style="float:left;" type="button" class="layui-btn layui-btn-primary" upload-input="formpic{$formkey}" upload-preview="formpic{$formkey}Preview" onclick="uploader(this)">上传图片</button>
								<div id="formpic{$formkey}Preview" style="float:left;padding-top:10px;clear: both;">
									<div class="layui-imgbox" style="width:100px;"><div class="layui-imgbox-img"><img src="{$val}"/></div></div>
								</div>
							</div>
						</div>
						{/if}
						{if $item.key=='region'}
						<div class="layui-form-item region_item" id="region{$customeKey}" data-text="{$val}">
							<label class="layui-form-label" >{$item.val1}：</label>
							<div class="layui-input-inline custom_province_div" style="width: 150px">
								<select name="formdata[{$formkey}][]" id="region{$customeKey}_province" lay-filter="region{$customeKey}_province"></select>
							</div>
							<div class="layui-input-inline custom_city_div" style="width: 150px">
								<select name="formdata[{$formkey}][]" id="region{$customeKey}_city" lay-filter="region{$customeKey}_area"></select>
							</div>
							<div class="layui-input-inline custom_area_div" style="width: 150px" style="display:none">
								<!--							<select name="custom[form{$customeKey}][]" id="region{$customeKey}_area"></select>-->
								<select name="formdata[{$formkey}][]" id="region{$customeKey}_area"></select>
							</div>
						</div>
						{/if}
						{/volist}
					
  					{/if}
				    <!--自定义信息end-->
					  
					  <div class="layui-form-item">
						<label class="layui-form-label">驳回原因</label>
						<div class="layui-input-inline">
							<input type="text" name="info[checkreason]" id="checkreason" class="layui-input" value="{$info.checkreason}">
						</div>
					</div>

					<div class="layui-form-item">
					  <label class="layui-form-label"></label>
					  <div class="layui-input-block">

						  <button class="layui-btn" lay-submit lay-filter="membercheck">通过</button>		
						  <button class="layui-btn layui-btn-primary" onclick="setst()" >驳回</button>		

					  </div>
					</div>
					</div>
			   </div>
			</div>
		</div>
	</div>
</div>
</div>
  {include file="public/js"/}
	<script>
	//日期范围选择
	layui.laydate.render({
		elem: '#birthday',
		trigger: 'click',
		range: false //或 range: '~' 来自定义分割字符
	});	

	var levelArr = {:jsonEncode($levelArr)};
	var defaultlevelid = "{$defaultlevel['id']}";
	layui.form.on('checkbox(levelcq)', function(data){
		if(data.elem.checked){
			$('#levelendtime_div').hide();
		}else{
			$('#levelendtime_div').show();
		}
	});
	layui.form.on('checkbox(level_extend_cq)', function(data){
		if(data.elem.checked){
			$('#level_extend_endtime_div').hide();
		}else{
			$('#level_extend_endtime_div').show();
		}
	});
	layui.form.on('select(yxqset)', function(data){
		var levelid = data.value
		if(levelid != defaultlevelid){
			$('#yxqset').show();
		}else{
			$('#yxqset').hide();
		}
		setareafenhong();
	});
	layui.form.on('radio(areafenhongChange)',function(data){
		setareafenhong(this);
	});
	function setareafenhong(e){
		var formdata = layui.form.val('form');
		var areafenhong = $(e).val();
		var levelid = $(e).parents('.level-box').find('.levelid').val();
		var parent = $(e).parents('.level-box');
		if((areafenhong==0 && levelArr[levelid].areafenhong != 0) || areafenhong==1 || areafenhong==2 || areafenhong==3 || areafenhong==10){
			parent.find('.areafenhong_address').show();
			parent.find('.areafenhong_largearea_div').hide();
			parent.find('.areafenhong_province_div').hide();
			parent.find('.areafenhong_city_div').hide();
			parent.find('.areafenhong_area_div').hide();
			if((areafenhong==0 && levelArr[levelid].areafenhong == 10) || areafenhong==10){
				parent.find('.areafenhong_largearea_div').show();
			}
			if((areafenhong==0 && levelArr[levelid].areafenhong == 1) || areafenhong==1){
				parent.find('.areafenhong_province_div').show();
			}
			if((areafenhong==0 && levelArr[levelid].areafenhong == 2) || areafenhong==2){
				parent.find('.areafenhong_province_div').show();
				parent.find('.areafenhong_city_div').show();
			}
			if((areafenhong==0 && levelArr[levelid].areafenhong == 3) || areafenhong == 3){
				parent.find('.areafenhong_province_div').show();
				parent.find('.areafenhong_city_div').show();
				parent.find('.areafenhong_area_div').show();
			}
		}else{
			parent.find('.areafenhong_address').hide();
		}
		if(areafenhong==0 || areafenhong==4){
			parent.find('.areafenhong_bili').hide();
		}else{
			parent.find('.areafenhong_bili').show();
		}
	}
	//日期范围选择
	layui.laydate.render({
		elem: '#levelendtime',
		trigger: 'click'
	});
	//日期范围选择
	layui.laydate.render({
		elem: '#level_extend_endtime',
		trigger: 'click'
	});
	//所有的时间控件
	$('.timeinput').each(function (e){
		var objId = $(this).attr('id');
		layui.laydate.render({
			elem: "#"+objId,
			type: 'time'
		})
	})
	//所有的日期控件
	$('.dateinput').each(function (e){
		var objId = $(this).attr('id');
		layui.laydate.render({
			elem: "#"+objId,
			type: 'date'
		})
	})

	{if $register_record}
		$('.region_item').each(function (index,obj){
			var regionId = $(obj).attr('id');
			var areatext = $(obj).data('text');
			var provinceId = regionId+'_province';
			var cityId = regionId+'_city';
			var areaId = regionId+'_area';
			var provinceVal = '';
			var cityVal = '';
			var areaVal = '';
			if(areatext){
				var areaAry = areatext.split(',');
				if(areaAry.length>0){
					provinceVal = areaAry[0];
				}
				if(areaAry.length>1){
					cityVal = areaAry[1];
				}
				if(areaAry.length>2){
					areaVal = areaAry[2];
				}
			}
			address3(provinceId,cityId,areaId,provinceVal,cityVal,areaVal);
		})
	{/if}

	var upload = layui.upload;
  //执行实例
  var uploadInst = upload.render({
    elem: '#headimgupload' //绑定元素
    ,url: "{:url('upload/index')}" //上传接口
    ,done: function(res){
			$('#headimg').val(res.data)
			$('#headimgPreview').attr('src',res.data);
      //上传完毕回调
    }
    ,error: function(){
      //请求异常回调
    }
  });

	layui.form.on('submit(membercheck)', function(obj){
		var field = obj.field
		var id = field['infoid']
		$.post("{:url('setst')}",{id:id,st:1},function(data){
			// /layer.close(index);
			dialog(data.msg,data.status);
			if(data.status == 1){
				setTimeout(function(){
					parent.layer.closeAll();
					parent.tableIns.reload()
				},1000)
			}
		})
	})
	layui.form.on('submit(memberreject)', function(obj){
		var field = obj.field
		var id = field['infoid']
		$.post("{:url('setst')}",{id:id,st:2},function(data){
			// /layer.close(index);
			dialog(data.msg,data.status);
			if(data.status == 1){
				setTimeout(function(){
					parent.layer.closeAll();
					parent.tableIns.reload()
				},1000)
			}
		})
	})
	function setst(){
		var id = $('#infoid').val()
		
		$.post("{:url('setst')}",{id:id,st:2,checkreason:$('#checkreason').val()},function(data){
			// /layer.close(index);
			dialog(data.msg,data.status);
			if(data.status == 1){
				setTimeout(function(){
					parent.layer.closeAll();
					parent.tableIns.reload()
				},1000)
			}
		})
	}
  </script>
	{include file="public/copyright"/}
</body>
</html>